package com.yong.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述:
 *
 * @author BluceYoung
 * @create 2020-06-28 10:35
 * B站：TeacherYoung凌风
 * www.teacheryoung.com
 */
@Configuration
public class ElasticsearchClientConfig {

    /**
     * 往容器里注入一个RestHighLevelClient
     * @return
     */
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("192.168.220.155", 9200, "http")
                )
        );
        return restHighLevelClient;
    }
}
